package com.axonactive.yolo.service.internal;

import org.apache.log4j.Logger;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

import com.axonactive.yolo.service.automatic.search.TaskPrepartion;

public class QuartzJobTaskPrepartion extends QuartzJobBean {
	
	private static final Logger LOGGER = Logger.getLogger(TaskPrepartion.class);
	
	private TaskPrepartion taskPrepartion;

	public void setTaskPrepartion(TaskPrepartion taskPrepartion) {
		this.taskPrepartion = taskPrepartion;
	}

	protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
		LOGGER.info("===QUARTZJOB STARTED");
		
		try{
			taskPrepartion.run();
		}catch(Exception e){
			LOGGER.info("loi roi mi oi");
			e.printStackTrace();
		}
		LOGGER.info("===QUARTZJOB FINISHED");
	}
}
